<template>
  <div class="empty">
    <img class="img" :style="{ width: imgWidth }" src="../assets/images/empty-image.png" alt="暂无数据" />
    <div class="empty_text">
      <slot>
        <span>{{ title }}</span>
      </slot>
    </div>
  </div>
</template>

<script>
export default {
  name: 'EmptyCom',
  components: {},
  props: {
    title: {
      type: String,
      default: '暂无数据',
    },
    width: {
      type: [String, Number],
    },
  },
  data() {
    return {}
  },
  computed: {
    imgWidth() {
      return typeof this.width === 'number' ? `${this.width}px` : this.width
    },
  },
  watch: {},
  created() {},
  mounted() {},
  methods: {},
}
</script>

<style lang="scss" scoped>
.empty {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  .img {
    width: 30%;
  }
  .empty_text {
    font-size: 16px;
    color: #999;
  }
}
</style>
